#include "src/Zombie.h"
#include <stdlib.h>

Zombie* initZombie (int x, int y)
{
  //  Zombie * zomb;
   Zombie * zomb = malloc(1*sizeof(Zombie));
   int alea;
   alea = rand() % 3 +1;
    zomb->x_Zombie=x;
    zomb->y_Zombie=y;
    zomb->vie_Zombie=alea;
    zomb->direction = 'h';
    return zomb;
}

void deplacementZombieHaut (Zombie *zomb, Terrain *ter)
{
    if (deplacementZombieValide (ter, zomb->x_Zombie, zomb->y_Zombie-1) == 1 )
    zomb->y_Zombie = zomb->y_Zombie - 1;
}

void deplacementZombieBas (Zombie *zomb, Terrain *ter)
{
    if (deplacementZombieValide (ter, zomb->x_Zombie, zomb->y_Zombie-1) == 1 )
    zomb->y_Zombie = zomb->y_Zombie + 1;
}

void deplacementZombieDroite (Zombie *zomb, Terrain *ter)
{
     if (deplacementZombieValide (ter, zomb->x_Zombie, zomb->y_Zombie-1) == 1 )
    zomb->x_Zombie = zomb->x_Zombie + 1;
}

void deplacementZombieGauche (Zombie *zomb, Terrain *ter)
{
    zomb->x_Zombie = zomb->x_Zombie - 1;
}

/*static void Enpause (Zombie *zomb)
{
    zomb->vie_Zombie = -1;
    zomb->x_Zombie = 50;
    zomb->y_Zombie = 50;
    zomb->direction = 'd';
}*/


int getCoordXZombie (Zombie * zomb)
{
    return zomb->x_Zombie;
}

int getCoordYZombie (Zombie * zomb)
{
    return zomb->y_Zombie;
}

void setCoordXZombie (Zombie *zomb , int x)
{
    zomb->x_Zombie = x;
}

void setCoordYZombie (Zombie *zomb , int y)
{
    zomb->y_Zombie = y;
}

int getVieZombie (Zombie *zomb)
{
    return zomb->vie_Zombie;
}

void setVieZombie (Zombie *zomb, int nb )
{
    zomb->vie_Zombie = nb;
}

char getdirectionZombie ( Zombie *zomb)
{
    return zomb->direction;
}

void setdirectionZombie (Zombie *zomb , char a)
{
    zomb->direction = a ;
}
